//
//  Contact.m
//  04_容器类
//
//  Created by dllo on 16/7/7.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "Contact.h"

@implementation Contact

- (instancetype)initWithName:(NSString *)name phoneNumber:(NSString *)phoneNumber {
    self = [super init];
    if (self) {
        _name = [name capitalizedString];
        _phoneNumber = phoneNumber;
        _groupName = [_name substringToIndex:1];
    }
    return self;
}

- (NSString *)description {
    return [NSString stringWithFormat:@"name:%@, phoneNumber:%@, sex = %@, address = %@, groupName = %@, age = %ld.", _name, _phoneNumber, _sex, _address, _groupName, _age];
}

- (void)showContact {
    NSLog(@"name:%@, phoneNumber:%@.", _name, _phoneNumber);
}

@end
